package com.github.thinwonton.cas.showcase.webapp.taobao.web.controller;

import com.github.thinwonton.cas.showcase.webapp.taobao.entity.Seckill;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/seckill")
public class SeckillController {

    @RequestMapping()
    public ModelAndView showIndex() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("/seckill/index");
        return modelAndView;
    }

    @RequestMapping(value = "/{id}")
    @ResponseBody
    public Seckill getSeckill(@PathVariable(value = "id") int id) {
        Seckill seckill = new Seckill();
        seckill.setId(id);
        seckill.setName("hugo");
        return seckill;
    }

}
